$(() => {
    // 个人信息
    $(".dp-mine").click(() => {
        $("#mine").fadeIn(300);
    })
    $(".m-model>.iconguanbi").click(() => {
        $("#mine").fadeOut(300);
    })

    // 销假规则说明
    $(".dp-explain").click(() => {
        $("#explain").fadeIn(300);
    })
    $(".bottom>.close").click(() => {
        $("#explain").fadeOut(300);
    })

    // 请假信息
    $(".information").click(() => {
        $(".information>span").addClass("current");
        $(".erweima>span").removeClass("current");
        $(".info-box").fadeIn(300);
        $(".ewm-box").fadeOut(300);
        $("#inspect").css("display", "none");
    })

    // 核验二维码
    $(".erweima").click(() => {
        $(".erweima>span").addClass("current");
        $(".information>span").removeClass("current");
        $(".ewm-box").fadeIn(100);
        $(".info-box").fadeOut(100);
        $("#inspect").css("display", "block");
    })

    //创建Date对象
    var date = new Date();
    var timer = document.querySelector(".timer");
    var insTime = document.querySelector(".insTime");
    //调用函数
    timemove();

    //定义函数
    function timemove() {
        //定义个个时间变量
        var date = new Date();
        var year = date.getFullYear();
        var mth = date.getMonth() + 1;
        var d = date.getDate();
        var h = date.getHours();
        var m = date.getMinutes();
        var s = date.getSeconds();

        //定义拼接变量,变量调用转换两位数函数
        var time = "当前时间:" + year + "-" + fn(mth) + "-" + fn(d) + "&nbsp;" + fn(h) + ":" + fn(m) + ":" + fn(s);

        //定义函数，将一位数"1"转为两位数"01"
        function fn(str) {
            str < 10 ? str = "0" + str : str;
            return str;
        }
        //定义定时器，调用函数，每秒刷新
        setInterval(timemove, 1000);
        //拼接变量显示在页面
        timer.innerHTML = time;
        insTime.innerHTML = time;
    }

    // 审批流程模态框
    $("#application .look").click(() => {
        $("#flow-model").fadeIn(300);
    })
    $("#flow-model .close").click(() => {
        $("#flow-model").fadeOut(300);
    })

    function startT() {
        var startDate = new Date();
        // var start = "" + mydate.getFullYear() + "年";
        // start += (mydate.getMonth() + 1) + "月";
        // start += mydate.getDate() + "日";
        var start = (startDate.getMonth() + 1) < 10 ? '0' + (startDate.getMonth() + 1) : (startDate.getMonth() + 1);
        start += "-";
        start += (startDate.getDate() < 10) ? '0' + startDate.getDate() : startDate.getDate();
        return start;
    }

    function endT() {
        var endDate = new Date();
        var end = (endDate.getMonth() + 1) < 10 ? '0' + (endDate.getMonth() + 1) : (endDate.getMonth() + 1);
        end += "-";
        end += (endDate.getDate() + 1 < 10) ? '0' + endDate.getDate() + 1 : endDate.getDate() + 1;
        return end;
    }

    function lookT() {
        var lookDate = new Date();
        // var start = "" + mydate.getFullYear() + "年";
        // start += (mydate.getMonth() + 1) + "月";
        // start += mydate.getDate() + "日";
        var lookT = lookDate.getFullYear() + "-";
        lookT += (lookDate.getMonth() + 1) < 10 ? '0' + (lookDate.getMonth() + 1) : (lookDate.getMonth() + 1);
        lookT += "-";
        lookT += (lookDate.getDate() < 10) ? '0' + lookDate.getDate() : lookDate.getDate();
        return lookT;
    }
    // var startTime = document.querySelector(".startTime");
    // var endTime = document.querySelector(".endTime");
    $(".startTime").html(startT());
    $(".endTime").html(endT());
    $(".lookTime").html(lookT());
})